package ${dtoPackage};

<#list po.getImportList(po.importFields) as import>
import ${import};
</#list>
<#list po.importFields as field>
<#if ! field.nullable>
import javax.validation.constraints.NotNull;
<#break>
</#if>
</#list>
<#list po.importFields as field>
<#if field.string>
import javax.validation.constraints.Size;
<#break>
</#if>
</#list>

import com.odianyun.db.mybatis.base.IBaseId;
import com.odianyun.project.base.IEntity;
<#if ! po.rel??>
import com.odianyun.project.support.data.model.ISheetRow;
</#if>

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
<#list po.importFields as field>
<#if field.dataSourceType?? && field.dataSourceType == "code">
import com.odianyun.project.support.cache.DictUtils;
import com.odianyun.util.value.ValueUtils;
<#break>
</#if>
</#list>

/**
 * ${po.title}
 * @CreateDate ${date}
 */
 @ApiModel("${po.title}ImportDTO")
public class ${po.name}ImportDTO implements IEntity, IBaseId<Long><#if ! po.rel??>, ISheetRow</#if> {
    @ApiModelProperty
    private Long id;
    <#list po.importFields as field>
    /**
     * ${field.title}
     */
    <#if ! field.nullable>
    @NotNull
    </#if>
    <#if field.string>
    @Size(min = <#if field.nullable>0<#else>1</#if>, max = <#if field.relName?ends_with('Name')>50<#elseif field.relName == 'name'>50<#else>${field.size?string('####')}</#if>, message = "${field.title!field.relName}输入不正确")
    </#if>
    @ApiModelProperty(value="${field.title!field.relName}", notes="最大长度：${field.size?string('####')}")
    private ${field.typeName} ${field.relName};
    </#list>

    <#if ! po.rel??>
    private int row;
    </#if>

    @Override
    public void setId(Long id) {
        this.id = id;
    }
    @Override
    public Long getId() {
        return id;
    }
    <#list po.importFields as field>
    public void set${field.relName?cap_first}(${field.typeName} ${field.relName}) {
        this.${field.relName} = ${field.relName};
    }
    public ${field.typeName} get${field.relName?cap_first}() {
        return ${field.relName};
    }
    </#list>

    <#if ! po.rel??>
    @Override
    public int getRow() {
        return row;
    }
    public void setRow(int row) {
        this.row = row;
    }
    </#if>

	  /*---------------------------------- extra info --------------------------------*/
	  <#list po.importFields as field>
    <#if field.dataSourceType?? && field.dataSourceType == "code">
    public void set${field.relName?cap_first}Str(String ${field.relName}Str) {
        this.${field.relName} = ValueUtils.convert(DictUtils.getCode("${field.dataSourceKey}", ${field.relName}Str), ${field.typeName}.class);
    }
    </#if>
	  </#list>
}